# -*- coding:utf-8 -*-
"""
Author：Administrator
Date:2022年01月12日
"""
import requests
from lxml import etree
import os
import time

if not os.path.exists('./海报'):
	os.mkdir('./海报')


headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"}

for i in range(1,4):
	url = f"https://www.jkl.com.cn/phoLis.aspx?current={i}"
	data = requests.get(url, headers=headers).text
	resp = etree.HTML(data)
	links = resp.xpath('//div[@class="proLis"]//@src')
	# print(links)
	for j in links:
		# print(j)
		if j != '':
			link = "https://www.jkl.com.cn/"+j
			img_data = requests.get(url=link,headers=headers).content
			img_name = link.split('/')[-1]
			img_path = './海报/'+img_name
			with open(img_path,'wb') as f:
				f.write(img_data)
				print(img_name+'下载成功!')
				time.sleep(1)

print('下载全部完成!')